import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use( VueRouter )

const routes = [ {
		path: '/',
		name: 'Layout',
		component: () => import( '@/views/Layout.vue' ),
		redirect: {
			name: 'Home'
		},
		children: [ {
			path: 'home',
			name: 'Home',
			component: () => import( '@/views/Home.vue' )
		}, {
			path: 'car',
			name: 'Car',
			component: () => import( '@/views/Car.vue' )
		}, {
			path: 'search',
			name: 'Search',
			component: () => import( '@/views/Search.vue' )
		}, {
			path: 'member',
			name: 'Member',
			component: () => import( '@/views/Member.vue' )
		} ]
	},
	{
		path: '/postlist',
		name: 'Postlist',
		component: () => import( '@/views/Postlist.vue' )
	},
	{
		path: '/share',
		name: 'Share',
		component: () => import( '@/views/Share.vue' )
	},
	{
		path: '/article/:id',
		name: 'Article',
		component: () => import( '@/views/Article.vue' )
	},
	{
		path: '/goods',
		name: 'Goods',
		component: () => import( '@/views/Goods.vue' )
	},
	{
		path: '/goods_comment/:id',
		name: 'GoodsComment',
		component: () => import( '@/views/GoodsComment.vue' )
	},
	{
		path: '/goods_desc/:id',
		name: 'GoodsDesc',
		component: () => import( '@/views/GoodsDesc.vue' )
	}
]

const router = new VueRouter( {
	mode: 'history',
	base: process.env.BASE_URL,
	routes
} )

export default router
